<?php
class ServiceAction extends Action{
	function index(){
	    $arr = $this->gf();
		
		foreach ($arr as $k=>$v){
		    $array = explode('||',$v);
			$list[$array[1]] = explode('||',$v);
			$list[$array[1]][6] = msubstr(strip_tags($list[$array[1]][6]),0,64).'......';
		}
		
		ksort($list);
		$this->assign('list',$list);
		
		$this->display('web@service');
	}
	
	function show(){
		$name = $_GET['name'];

		$content = file_get_contents('Tpl/service/'.$name.'.html');
		
		$lab = explode('||',$content);
		
		$this->assign('lab',$lab);
		
		$arr = PHPAction::gf();

    	foreach ($arr as $k=>$v){
		    if($k==2){
			  break;
			}
			$list[$k] = explode('||',$v);
			$list[$k][2] = msubstr(strip_tags($list[$k][2]),0,64).'......';
			
		}
		$this->assign('list',$list);
		
		$this->display('web@service_show');
	}
	
	
	function gf(){
		$dir = dir('Tpl/service');
		while (($file = $dir->read()) !== false){
		    
			$ff = explode('.',$file);
			if($ff[1]=='html'){
				$arr[] = $file . '||' . file_get_contents('Tpl/service/'.$file);
			}
		}
		
		$dir->close();
		return $arr;
	}

}
?>